Repository navigation
Conversation
|
e069aa8 to
142c6f6
Compare
142c6f6 to
8e11d4f
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12062
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): doc/dox_comments/header_files/asn_public.h
Coverage: 10 of 12 in-scope changed file(s) opened by the reviewer; not opened: wolfssl/internal.h, wolfssl/wolfcrypt/asn.h
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12062
Scan targets checked: wolfssl-src, wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs
Not reviewed (no scan target covers them): doc/dox_comments/header_files/asn_public.h
Coverage: 2 of 3 in-scope changed file(s) opened by the reviewer; not opened: tests/api.c
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
Description
Fixes Fenrir #16791
When certificate or key copying is disabled, a
WOLFSSLobject can share DER buffers with itsWOLFSSL_CTX. Replacing a certificate chain or private key on the context afterwolfSSL_new()can release a buffer that the existing connection still needs and cause use-after-free.This change adds reference counting to
DerBufferso that a context and its connections can retain the same certificate, chain, or private key buffer and make the buffer freed only when its last reference is released.Background
This revisits the reference-counting approach proposed in #11109, which superseded #10905 and was closed without being merged. The approach in #11191 instead blocks certain context changes during callbacks regarding handshake.
The case addressed here does not require a context change inside a callback: the context can be always reloaded after
wolfSSL_new()and before the connection uses its certificate or key and that is the condition of the case.